// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Copyright (c) 2012 The cwkshell Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.




#include "cuc/src/cwkshell/view/shell_browser_window.h"

#include "base/auto_reset.h"
#include "base/win/wrapped_window_proc.h"
#include "content/public/browser/web_contents.h"
#include "cuc/src/cwkshell/browser/shell_browser.h" 
#include "cuc/src/cwkshell/view/shell_browser_window_non_client_view.h" 
#include "ui/gfx/rect.h"
#include "ui/base/win/hwnd_util.h"
namespace cuc {
	namespace shell {


		ShellBrowserWindow::ShellBrowserWindow(content::WebContents* web_contents)
			: ShellWindow(web_contents)
		{
			Init();
			if(ShellBrowser::property()->GetChildWindowIsFullScreen()){
				AddAccelerator(ui::Accelerator(ui::VKEY_F12, ui::EF_NONE));
			}
			window_title_ = L"cwkshell window";
			ShellBrowser::instance()->OnWindowCreated(this);
			 
		}

		ShellBrowserWindow::~ShellBrowserWindow() {

				
		}

		
		ShellBrowserWindow* ShellBrowserWindow::CreateShellBrowserWindow(
			content::WebContents* web_contents, 
			 const ShellWindow::Feature& feature)
		{
			LOG(INFO)<<"ShellBrowserWindow::CreateShellBrowserWindow: feature.height = "<<feature.height;
			

			ShellBrowserWindow* shell = new ShellBrowserWindow(web_contents);
			bool ismaxsize = ShellBrowser::property()->GetChildWindowIsMaxSize();
			if(ShellBrowser::property()->GetChildWindowIsFullScreen()){
				shell->ShowWindowFullScreen(gfx::Size(800,600));
			}
			else{
				int height = ShellBrowser::property()->GetChildWindowInitHeight();
				int width = ShellBrowser::property()->GetChildWindowInitWidth();
				shell->ShowWindow(gfx::Size(width,height),ismaxsize);
			}
				
			LOG(INFO)<<"ShellBrowserWindow::CreateShellBrowserWindow() CALLED";
			return shell;
		}

		views::NonClientFrameView* 
			ShellBrowserWindow::CreateNonClientFrameView( views::Widget* widget ) 
		{
			ShellBrowserWindowNonClientView* view = new ShellBrowserWindowNonClientView;
			view->Init(widget);
			return view;
		}
		

	
	}  // namespace shell
}  // namespace cuc
